With the growing popularity of digital cameras, photos are more commonly stored electronically on computers instead of physically on paper. User interfaces have been developed to allow a user to manage and view his or her photos electronically. As part of these user interfaces, the user sometimes has the option of viewing photos as smaller, thumbnail versions. In addition, the user is sometimes presented with the option of choosing a particular layout in which the photo thumbnails are arranged for viewing. For instance, a user may view a tiled layout where the thumbnails are arranged in rows and columns, or as a stacked view.
Whichever layout is chosen, it is necessary to arrange the photos such that they are able to be properly presented in that layout. The particular arrangement may need to take into account the number of photos to be viewed, the sizes of the photos, and their aspect ratios.